//package com.pro.common.service.pay.third.systempay;
//
//import cn.hutool.json.JSONObject;
//import com.pro.common.api.CommonConst;
//import com.pro.common.api.auth.IUserService;
//import com.pro.common.api.message.ToSocket;
//import com.pro.common.modules.service.dependencies.auth.MessageService;
//import com.pro.common.service.pay.controller.PayCommonController;
//import com.pro.common.service.pay.dao.UserRecharge;
//import com.pro.common.service.pay.model.dto.*;
//import com.pro.common.service.pay.service.PayChannelService;
//import com.pro.common.service.pay.service.PayMerchantService;
//import com.pro.common.service.pay.dao.UserRechargeService;
//import com.pro.common.service.pay.dao.UserTransferService;
//import jakarta.servlet.http.HttpServletRequest;
//import jakarta.servlet.http.HttpServletResponse;
//import lombok.Getter;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RestController;
//
//import java.io.IOException;
//import java.util.HashMap;
//import java.util.List;
//import java.util.Map;
//
//@Slf4j
//@Getter
//@RestController
//@RequestMapping("pay/systempay/{MER_CODE}")
//public class SystemPayController extends PayCommonController {
//
//    @Autowired
//    private PayMerchantService merchantService;
//    @Autowired
//    private PayChannelService channelService;
//    @Autowired
//    private UserRechargeService rechargeService;
//    @Autowired
//    private UserTransferService userTransferService;
//    @Autowired
//    private IUserService userService;
//    @Autowired
//    private MessageService messageService;
//    //通道编号
//    private String merCode = "SYSTEMPAY";
//
//    @Override
//    public UserRecharge unifiedOrder(String MER_CODE, UnifiedOrderRequest requestVo, HttpServletRequest request, HttpServletResponse response) throws IOException {
//        UserRecharge userRecharge = super.unifiedOrder(MER_CODE, requestVo, request, response);
//        // 线下充值 通知管理后台确认
//        messageService.sendToManager(ToSocket.toUser(CommonConst.EntityClass.UserRecharge, List.of(userRecharge)));
//        return null;
//    }
//
//    /**
//     * payMerchant.apiUrl 为空,只下单不请求外部,不需要构造
//     */
//    @Override
//    protected Map<String, Object> unifiedOrderBuildParams(UnifiedOrderIO.Params params) {
//        return new HashMap<>();
//    }
//
//    /**
//     * admin 回调 pay
//     */
//    @Override
//    protected NotifyIO.Params notifyReadData(JSONObject data) {
//        return NotifyIO.Params.builder()
//                .no(data.getStr("no"))
//                .statusSuccess(true)
//                .amount(data.getStr("money")) // 实际收款金额
//                .build();
//    }
//
//    /**
//     * 线下代付,直接修改状态 暂时不需要走pay
//     * payMerchant.withdrawUrl 为空,只下单不请求外部,不需要构造
//     */
//    @Override
//    protected Map<String, Object> payoutBuildParams(PayoutIO.Params params) {
//        return new HashMap<>(16);
//    }
//
//    @Override
//    protected PayoutNotifyIO.Params payoutNotifyReadData(JSONObject data) {
//        return null;
//    }
//}
